package com.gitee.somenvm.ninerpgitem.core.ui

import com.gitee.somenvm.ninerpgitem.api.event.plugin.NineRpgItemReloadEvent
import com.gitee.somenvm.ninerpgitem.util.success
import org.bukkit.command.CommandSender
import taboolib.common.platform.event.SubscribeEvent
import taboolib.common.platform.function.console
import taboolib.module.configuration.Config
import taboolib.module.configuration.Configuration

object UIManager {
    @Config("ui/InlayTable.yml", migrate = true, autoReload = true)
    lateinit var inlayTableConfig: Configuration

    @Config("ui/InlayInfoUI.yml", migrate = true, autoReload = true)
    lateinit var inlayInfoConfig: Configuration

    @Config("ui/BluePrintList.yml", migrate = true, autoReload = true)
    lateinit var bluePrintListConfig: Configuration

    @Config("ui/ForgeTable.yml", migrate = true, autoReload = true)
    lateinit var forgeTableConfig: Configuration

    @Config("ui/StrengthenUI.yml", migrate = true, autoReload = true)
    lateinit var strengthenUIConfig: Configuration

    @SubscribeEvent
    fun e(e: NineRpgItemReloadEvent.Config) {
        bluePrintListConfig.reload()
        forgeTableConfig.reload()
        inlayTableConfig.reload()
        inlayInfoConfig.reload()
        strengthenUIConfig.reload()
        console().cast<CommandSender>().success("重载UI配置文件.")
    }
}